package yang.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * DrugType entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "drug_type", catalog = "hospital")
public class DrugType implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -8589571695202582186L;
	private String id;//UUID
	private String typeName;//药品类型名称
	private Set<HospitalDrug> hospitalDrugs = new HashSet<HospitalDrug>(0);

	// Constructors

	/** default constructor */
	public DrugType() {
	}

	/** minimal constructor */
	public DrugType(String id) {
		this.id = id;
	}

	/** full constructor */
	public DrugType(String id, String typeName, Set<HospitalDrug> hospitalDrugs) {
		this.id = id;
		this.typeName = typeName;
		this.hospitalDrugs = hospitalDrugs;
	}

	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "type_name", length = 200)
	public String getTypeName() {
		return this.typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "drugType")
	public Set<HospitalDrug> getHospitalDrugs() {
		return this.hospitalDrugs;
	}

	public void setHospitalDrugs(Set<HospitalDrug> hospitalDrugs) {
		this.hospitalDrugs = hospitalDrugs;
	}

}